package com.cpit.platform.security.service;
import org.springframework.security.core.GrantedAuthority;  

/** 
 * 权限信息 
 *  
 * @author ChengLi 
 * 
 */  
public class AuthorityInfo implements GrantedAuthority {  
    private static final long serialVersionUID = -175781100474818800L;  
  
    /** 
     * 权限CODE 
     */  
    private String authority;  
  
    public AuthorityInfo(String authority) {  
        this.authority = authority;  
    }  
  
    @Override  
    public String getAuthority() {  
        return authority;  
    }  
  
    public void setAuthority(String authority) {  
        this.authority = authority;  
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((authority == null) ? 0 : authority.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AuthorityInfo other = (AuthorityInfo) obj;
		if (authority == null) {
			if (other.authority != null)
				return false;
		} else if (!authority.equals(other.authority))
			return false;
		return true;
	}  
  
}  